<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-accountAddress-edit"
			th:object="${accountAddress}">
			<input id="id" name="id" th:field="*{id}" type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">转账类型：</label>
				<div class="col-sm-8">
				  <select id="transType" name="transType" class="form-control m-b" th:with="type=${@dict.getType('trans_type')}">
	                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
	                </select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">转出地址：</label>
				<div class="col-sm-8">
					<input id="turnOutWalletAddress" name="turnOutWalletAddress" th:field="*{walletAddress}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">转入地址：</label>
				<div class="col-sm-8">
					<input id="turnInWalletAddress" name="turnOutWalletAddress" class="form-control" type="text">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-3 control-label">转账金额：</label>
				<div class="col-sm-5">
					<input id="walletBalance" name="walletBalance"  class="form-control" type="text">
				</div>
				<div class="col-sm-3">
					<a class="btn btn-primary btn-rounded btn-sm" onclick="turnWalletBalance();"><i class="fa  fa-edit"></i>&nbsp;发送交易</a>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">交易码：</label>
				<div class="col-sm-8">
					<input id="transHash" name="transHash" class="form-control" type="text">
				</div>
				
			</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript">
		var prefix = ctx + "manager/accountAddress";
		//积分转账
		function turnWalletBalance() {
			$.ajax({
				type : "GET",
				url : prefix + "/turnAddressBalance/"+$("#transType").val()+"/"+ $("#turnOutWalletAddress").val()+"/"+$("#turnInWalletAddress").val()+"/"+$("#walletBalance").val(),
				dataType : "json",
				success : function(data) {
					if (data.code == 0) {
						$("#transHash").val(data.msg);
					} else {
						$.modal.alertWarning(data.msg);
					}
				},
				error : function(jqXHR) {
					$.modal.alertWarning("转账异常");
				}
			});

		}
		
	</script>
</body>
</html>
